package com.syg.logback.core;

import com.syg.boot.util.net.NetUtil;
import com.syg.logback.consts.LogTypeEnum;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * @author syg
 * @version 1.0
 * @date 2021年11月24日19:14:46
 */
public class ApiTranInf implements Serializable {

    private static final long serialVersionUID = 2606826830719572240L;
    private String reqIp;
    private int reqPort;
    private String path;
    private String method;
    private String requestJson;
    private String responseJson;
    private long exeTm;
    private String exeIp;
    private String exeSts;
    private String respCode;
    private String respMsg;
    private String emplyNo;
    private String emplyName;
    private String grayscaleFlag;

    public ApiTranInf(String reqIp, int reqPort, String path, String method, String requestJson, String responseJson, long exeTm, String exeSts) {
        this.reqIp = reqIp;
        this.reqPort = reqPort;
        this.path = path;
        this.method = method;
        this.requestJson = requestJson;
        this.responseJson = responseJson;
        this.exeTm = exeTm;
        this.exeSts = StringUtils.isEmpty(exeSts) ? "S" : exeSts;
    }

    @Override
    public String toString() {
        return LogTypeEnum.CHAIN + "@@@" + this.reqIp + "#@%@#" + this.reqPort + "#@%@#" + this.path + "#@%@#" + this.method + "#@%@#" + this.requestJson + "#@%@#" + this.responseJson + "#@%@#" + this.exeTm + "#@%@#" + NetUtil.getLocalHostIp() + "#@%@#" + this.exeSts + "#@%@#" + this.respCode + "#@%@#" + this.respMsg + "#@%@#" + this.emplyNo + "#@%@#" + this.emplyName + "#@%@#" + this.grayscaleFlag;
    }

    public void setReqIp(String reqIp) {
        this.reqIp = reqIp;
    }

    public void setReqPort(int reqPort) {
        this.reqPort = reqPort;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public void setRequestJson(String requestJson) {
        this.requestJson = requestJson;
    }

    public void setResponseJson(String responseJson) {
        this.responseJson = responseJson;
    }

    public void setExeTm(long exeTm) {
        this.exeTm = exeTm;
    }

    public void setExeIp(String exeIp) {
        this.exeIp = exeIp;
    }

    public void setExeSts(String exeSts) {
        this.exeSts = exeSts;
    }

    public void setRespCode(String respCode) {
        this.respCode = respCode;
    }

    public void setRespMsg(String respMsg) {
        this.respMsg = respMsg;
    }

    public void setEmplyNo(String emplyNo) {
        this.emplyNo = emplyNo;
    }

    public void setEmplyName(String emplyName) {
        this.emplyName = emplyName;
    }

    public void setGrayscaleFlag(String grayscaleFlag) {
        this.grayscaleFlag = grayscaleFlag;
    }

    public String getReqIp() {
        return this.reqIp;
    }

    public int getReqPort() {
        return this.reqPort;
    }

    public String getPath() {
        return this.path;
    }

    public String getMethod() {
        return this.method;
    }

    public String getRequestJson() {
        return this.requestJson;
    }

    public String getResponseJson() {
        return this.responseJson;
    }

    public long getExeTm() {
        return this.exeTm;
    }

    public String getExeIp() {
        return this.exeIp;
    }

    public String getExeSts() {
        return this.exeSts;
    }

    public String getRespCode() {
        return this.respCode;
    }

    public String getRespMsg() {
        return this.respMsg;
    }

    public String getEmplyNo() {
        return this.emplyNo;
    }

    public String getEmplyName() {
        return this.emplyName;
    }

    public String getGrayscaleFlag() {
        return this.grayscaleFlag;
    }
}
